package com.member.shop.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.member.common.annotation.Excel;
import com.member.common.config.RmConfig;
import com.member.common.constant.SystemConst;
import com.member.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 用户等级对象 sys_biz_grade_info
 *
 * @author thomas
 * @date 2024-10-27
 */
public class SysBizGradeInfo extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 唯一id
     */
    private Long id;

    /**
     * 等级编号
     */
    @Excel(name = "等级编号")
    private Integer gradeNo;

    /**
     * 等级名称
     */
    @Excel(name = "等级名称")
    private String gradeName;

    /**
     * 等级图标
     */
    @Excel(name = "等级图标")
    private String icon;

    /**
     * 升级所需积分
     */
    @Excel(name = "升级所需经验值")
    private Long upgradeIntegral;

    /**
     * 等级描述
     */
    @Excel(name = "等级描述")
    @ApiModelProperty(value = "等级描述")
    private String gradeDesc;


    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "获取时间")
    private Date obtainTime;


    @ApiModelProperty(value = "是否获取 0 未 1 获取")
    private Integer obtain;

    public Date getObtainTime() {
        return obtainTime;
    }

    public void setObtainTime(Date obtainTime) {
        this.obtainTime = obtainTime;
    }

    public Integer getObtain() {
        return obtain;
    }

    public void setObtain(Integer obtain) {
        this.obtain = obtain;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setGradeNo(Integer gradeNo) {
        this.gradeNo = gradeNo;
    }

    public Integer getGradeNo() {
        return gradeNo;
    }

    public void setGradeName(String gradeName) {
        this.gradeName = gradeName;
    }

    private String iconAbsolute;

    public String getGradeName() {
        return gradeName;
    }

    public void setIcon(String icon) {
        this.icon = icon;


        iconAbsolute = icon;
        String domain = RmConfig.getDomain();
        if (StringUtils.isNotEmpty(icon) && !icon.startsWith(SystemConst.HTTP)) {
            iconAbsolute = domain + icon;
        }

    }

    public String getIconAbsolute() {
        return iconAbsolute;
    }

    public void setIconAbsolute(String iconAbsolute) {
        this.iconAbsolute = iconAbsolute;
    }

    public String getIcon() {
        return icon;
    }

    public void setUpgradeIntegral(Long upgradeIntegral) {
        this.upgradeIntegral = upgradeIntegral;
    }

    public Long getUpgradeIntegral() {
        return upgradeIntegral;
    }

    public void setGradeDesc(String gradeDesc) {
        this.gradeDesc = gradeDesc;
    }

    public String getGradeDesc() {
        return gradeDesc;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId()).append("gradeNo", getGradeNo()).append("gradeName", getGradeName()).append("icon", getIcon()).append("upgradeIntegral", getUpgradeIntegral()).append("gradeDesc", getGradeDesc()).append("remark", getRemark()).append("createBy", getCreateBy()).append("updateBy", getUpdateBy()).append("createTime", getCreateTime()).append("updateTime", getUpdateTime()).toString();
    }
}
